import tkinter as tk
from tkinter import StringVar
from collect.grab import jdpa

class Pa(tk.Frame):

    def __init__(self, master=None):
        tk.Frame.__init__(self,master)
        self.openfilename = ""
        self.grid()
        self.createWidgets()
        
    def createWidgets(self):
        self.lb = tk.Label(self,text = '请输入网址:',width="10")
        self.lb.grid(row=0,column=0)
        self.e = StringVar()
        self.entrydis = tk.Entry(self,textvariable=self.e,width="30")
        self.e.set("https://item.jd.com/5181380.html")
        self.entrydis.grid(row=0,column=1,columnspan=2,sticky=tk.W)
        self.btpa = tk.Button(self,text="开始爬取",width="10",command=self.start)   
        self.btpa.grid(row=1,column=0,columnspan=3)
        
    def start(self):
        self.url = self.e.get()
        jdpa(self.url)        